package com.qjdchina.sku.converter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.springframework.beans.BeanUtils;

import com.qjdchina.sku.model.Brand;
import com.qjdchina.sku.model.ProductPicture;
import com.qjdchina.sku.model.vo.BrandVO;
import com.qjdchina.sku.model.vo.ProductPictureVO;

public class ProductPictureConverter {

	private ProductPictureConverter() {

	}

	public static ProductPictureVO toProductPictureVO(ProductPicture productPicture) {

		ProductPictureVO productPictureVO = new ProductPictureVO();
		if (null == productPicture) {
			return productPictureVO;
		}
		BeanUtils.copyProperties(productPicture, productPictureVO);
		return productPictureVO;
	}

	public static ProductPicture toProductPicture(ProductPictureVO productPictureVO) {

		ProductPicture productPicture = new ProductPicture();
		if (null == productPictureVO) {
			return productPicture;
		}
		BeanUtils.copyProperties(productPictureVO, productPicture);
		return productPicture;
	}

	public static List<ProductPictureVO> toProductPictureVOs(List<ProductPicture> productPictures) {

		if (null == productPictures) {
			return Collections.emptyList();
		}
		List<ProductPictureVO> productPictureVOs = new ArrayList<ProductPictureVO>();
		for (ProductPicture productPicture : productPictures) {
			productPictureVOs.add(ProductPictureConverter.toProductPictureVO(productPicture));
		}
		return productPictureVOs;
	}

}
